export function useVModel(vm, _key, handler) {
    const obj = {
        value: vm[_key],
    }
    vm.$watch(_key, {
        handler: (n, o) => {
            if (handler) {
                handler(n, o, obj)
            } else {
                obj.value = n
            }
        },
        deep: true,
        immediate: true
    })
    return new Proxy(obj, {
        get: (target, key, receiver) => {
            return target[key]
        },
        set: (target, key, newValue, receiver) => {
            target[key] = newValue
            vm.$emit(`update:${_key}`, newValue)
            return true
        }
    })
}
